package com.example.ali.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.widget.ImageView;
import android.widget.ListView;

import com.allure.lbanners.LMBanners;
import com.example.ali.R;
import com.example.ali.adapter.SchooltListViewAdpter;
import com.example.ali.adapter.StudentBannerAdapter;
import com.example.ali.entiy.School;
import com.githang.statusbar.StatusBarCompat;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class Schoolactivity extends Activity {

    @BindView(R.id.studentbanners)
    LMBanners banners;
    public ArrayList<School> studentlist;
    @BindView(R.id.go_index)
    ImageView goIndex;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_studentlist);
        ListView listView = (ListView) findViewById(R.id.listview);
        listView.setAdapter(new SchooltListViewAdpter(Schoolactivity.this,getdata()));
        ButterKnife.bind(this);
        StatusBarCompat.setStatusBarColor(this, ContextCompat.getColor(this, R.color.colorstatus));
        initBanners();
    }

    ArrayList<School> getdata() {
        studentlist = new ArrayList<School>();
        School school = new School();
        school.setTitle("我是标题");
        school.setData("2017年10月5日-2017年10月10日");
        school.setContent("我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容我是内容");
        school.setTitle("我是标题");
        Integer[] img = new Integer[3];
        img[0] = R.mipmap.activity01;
        img[1] = R.mipmap.activity02;
        img[2] = R.mipmap.activity03;
        school.setImg(img);
        studentlist.add(school);
        School students = new School();
        students.setTitle("我是标题2");
        students.setData("2017年10月5日-2017年10月10日");
        students.setTitle("我是标题2");
        students.setContent("我是内容我是内容我是内ss容我是内容我是内容我是内容我是内容我是内容我是内容");
        Integer[] img1 = new Integer[3];
        img1[0] = R.mipmap.activity01;
        img1[1] = R.mipmap.activity02;
        img1[2] = R.mipmap.activity03;
        students.setImg(img1);
        studentlist.add(students);

        return studentlist;

    }

    private void initBanners() {
        banners.setAutoPlay(true);//自动播放
        banners.setVertical(false);//是否可以垂直
        banners.setScrollDurtion(222);//两页切换时间
        banners.setCanLoop(true);//循环播放
        banners.setAdapter(new StudentBannerAdapter(this), getdata());
    }

    @OnClick(R.id.go_index)
    public void onViewClicked() {
        Intent intent=new Intent(this, MainActivity.class);
      startActivity(intent);
    }
}
